package com.xzx.annotation.custom;

import com.xzx.annotation.bean.Person04;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @author xinzhixuan
 * @version 1.0
 * @date 2025/4/17 19:55
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
        beanDefinition.setBeanClass(Person04.class);
        beanDefinition.setScope(GenericBeanDefinition.SCOPE_SINGLETON);
        registry.registerBeanDefinition("person04", beanDefinition);
    }
}
